package com.easygo.common;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import java.util.List;

public class JsonUtils {

    /**
     * JSOn转对象
     * @return 获得商品图片信息
     */
    public static List<GoodsUrl> json2GoodsUrl(String json){
        List<GoodsUrl> goodsUrls = JSON.parseObject(json, new TypeReference<List<GoodsUrl>>() {});
        return goodsUrls;
    }

    public static void main(String[] args) {
        String json="[{\"order\":\"1\",\"url\":\"http://192.168.6.130:8866/group1/M00/00/00/wKgGglw950qAWTsOAACXPpn4lRU540.png\"},{\"order\":\"2\",\"url\":\"http://192.168.6.130:8866/group1/M00/00/00/wKgGglw951mANdOoAABbGEjjcx0269.jpg\"}]";
        List<GoodsUrl> goodsUrls = json2GoodsUrl(json);
        for (GoodsUrl goodsUrl : goodsUrls) {
            System.out.println(goodsUrl);
        }
    }

}
